<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml">

	<ui:define name="body">

		<h:form id="activityView">


			<h:panelGrid columns="1" width="%100">
				<s:decorate id="MilestoneName" template="/layout/display.xhtml">
					<ui:define name="label">#{messages.milstoneName}</ui:define>
					<h:outputText value="#{activityHome.instance.name}" required="true" />
				</s:decorate>
				<s:decorate id="description" template="/layout/display.xhtml">
					<ui:define name="label">#{messages['txt.activityDetails']}</ui:define>
					<h:outputText value="#{activityHome.instance.desciption}"
						style="width: 500px" required="true" />
				</s:decorate>

				<s:decorate id="dueDate" template="/layout/display.xhtml">
					<ui:define name="label">#{messages.dueDate}</ui:define>
					<h:outputText value="#{activityHome.instance.dueDate}">
						<s:convertDateTime type="date" dateStyle="short"
							pattern="dd/MM/yyyy" />
					</h:outputText>
				</s:decorate>
				<s:decorate id="submissionField" template="/layout/display.xhtml">
					<ui:define name="label">#{messages['txt.CourseName']}</ui:define>
					<h:outputText value="#{activityHome.instance.schedule.course.name}" />
				</s:decorate>
			</h:panelGrid>

			<a4j:outputPanel
				rendered="#{activityHome.instance.submissionActivity}">
				<rich:panel>
					<f:facet name="header">#{messages.Submissions}</f:facet>
					<h:outputText value="There are no submissions yet!"
						rendered="#{activityHome.instance.projectDocuments.size==0 and (identity.hasRole('Instructor') or identity.hasRole('Teaching Assistant'))}" />
					<rich:dataTable id="instList" var="il"
						rendered="#{not empty activityHome.instance.projectDocuments and (identity.hasRole('Instructor') or identity.hasRole('Teaching Assistant'))}"
						value="#{activityHome.instance.projectDocuments}">
						<h:column>
							<f:facet name="header">#{messages['sch.docName']}</f:facet>
							<s:link value="#{il.fileName}"
								action="#{downloadLectureNotes.downloadSub}">
								<f:param name="attachmentId" value="#{il.id}" />
							</s:link>
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.teamName']}</f:facet>
							<h:outputText value="#{il.projectTeam.name}" />
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.uploadDate']}</f:facet>
							<h:outputText value="#{il.uploadedDate}">
								<s:convertDateTime type="date" dateStyle="short"
									pattern="dd/MM/yyyy" />
							</h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.Uploader']}</f:facet>
							<h:outputText value="#{il.uploader.nameToSrting()}">
							</h:outputText>
						</h:column>
					</rich:dataTable>

					<p />
					<rich:dataTable id="studList" var="il"
						rendered="#{not empty userSubmissionLists.teamsSubmissons(activityHome.instance.id)}"
						value="#{userSubmissionLists.teamsSubmissons(activityHome.instance.id)}">
						<h:column>
							<f:facet name="header">#{messages['sch.docName']}</f:facet>
							<s:link value="#{il.fileName}"
								action="#{downloadLectureNotes.downloadSub}">
								<f:param name="attachmentId" value="#{il.id}" />
							</s:link>
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.teamName']}</f:facet>
							<h:outputText value="#{il.projectTeam.name}" />
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.uploadDate']}</f:facet>
							<h:outputText value="#{il.uploadedDate}">
								<s:convertDateTime type="date" dateStyle="short"
									pattern="dd/MM/yyyy" />
							</h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.Uploader']}</f:facet>
							<h:outputText value="#{il.uploader.nameToSrting()}">
							</h:outputText>
						</h:column>
					</rich:dataTable>
				</rich:panel>
				</a4j:outputPanel>
				<p />
				<a4j:outputPanel rendered="#{activityHome.instance.reviewActivity!=null}">
				<rich:panel>
					<f:facet name="header">#{messages.ReviewSubmissions}</f:facet>
					<h:outputText value="There are no submissions to review yet!"
						rendered="#{userSubmissionLists.reviewSubmissions(activityHome.instance.id).size==0}" />
					<rich:dataTable id="rewList" var="il"
						rendered="#{not empty userSubmissionLists.reviewSubmissions(activityHome.instance.id)}"
						value="#{userSubmissionLists.reviewSubmissions(activityHome.instance.id)}">
						<h:column>
							<f:facet name="header">#{messages['sch.docName']}</f:facet>
							<s:link value="#{il.fileName}"
								action="#{downloadLectureNotes.downloadSub}">
								<f:param name="attachmentId" value="#{il.id}" />
							</s:link>
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.teamName']}</f:facet>
							<h:outputText value="#{il.projectTeam.name}" />
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.uploadDate']}</f:facet>
							<h:outputText value="#{il.uploadedDate}">
								<s:convertDateTime type="date" dateStyle="short"
									pattern="dd/MM/yyyy" />
							</h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">#{messages['sch.Uploader']}</f:facet>
							<h:outputText value="#{il.uploader.nameToSrting()}">
							</h:outputText>
						</h:column>
					</rich:dataTable>
				</rich:panel>
			</a4j:outputPanel>



			<div class="actionButtons">
				<s:button id="upload" value="#{messages.Upload}" rendered="#{activityHome.dateCheck() and !(identity.hasRole('Instructor') or identity.hasRole('Teaching Assistant'))}"
					view="/Course/submit.xhtml" propagation="join">
					
				</s:button>
				<s:button id="cancel" value="#{messages.Cancel}" propagation="end"
					view="/Course/course.xhtml">
				</s:button>
			</div>

		</h:form>

	</ui:define>

</ui:composition>